<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
 let array = [1, 2, , 4, 5];
let newArray = array.map((item) => {
    return item * item;
})
console.log(newArray)  // [1, 4, 9, 16, 25]
console.log(array)
// 清掉稀疏数组
console.log(array.filter(()=>true))
// map不会对空数组进行检测 
// map不会改变原始数组 

let array1 = [2, 3, 4, 5, 6];
let newArray1= array1.forEach((item) => {
    return item * item;
})
console.log(newArray1)  // [1, 4, 9, 16, 25]
console.log(array1)



  </script>
</body>
</html>